<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>MXML Tags</title>
<link rel="stylesheet" href="../style.css" type="text/css">
</head>
<body class="MainContent">
<script type="text/javascript" language="javascript" src="../asdoc.js"></script>
<h2>
<font size="-1">Compiler Tags</font>
<br>Binding</h2>
<hr>
<p></p>
<b>Binding</b>
<br>
	Tag implemented by the compiler

	<p>You use the  &lt;mx:Binding&gt; tag to tie the data in one object to another object. 
	When you use the &lt;mx:Binding&gt; tag, you provide a source property and a destination 
	property. You can use the &lt;mx:Binding&gt; tag to completely separate the view, or user interface, 
	from the model. the &lt;mx:Binding&gt; tag also lets you bind different source properties to the same 
	destination property.</p>

	<p><b>MXML Syntax</b></p>
	<p>The &lt;mx:Binding&gt; tag has the following syntax:</p>
	<p><PRE>
	&lt;mx:Binding 
		source="<i>No default.</i>"
		destination="<i>No deafult.</i>"
	/&gt;
	</pre>
	</p>
	In the following example, the properties of user interface controls are bound to the 
	myEmployee data model using the &lt;mx:Binding&gt; tag.
	<pre>
	&lt;?xml version="1.0" encoding="iso-8859-1"?&gt;
	&lt;mx:Application xlmns:mx="http://macromedia.com/mxml/2003"&gt;
	...
	&lt;!-- Form contains user input controls. --&gt;
		&lt;mx:Form label="Employee Information"&gt;
			&lt;mx:FormItem label="First Name"&gt;
				&lt;mx:TextInput id="firstName" /&gt;
			&lt;/mx:FormItem&gt;
			&lt;mx:FormItem label="Last Name"&gt;
				&lt;mx:TextInput id="lastName" /&gt;
			&lt;/mx:FormItem&gt;
			&lt;mx:FormItem label="Department"&gt;
				&lt;mx:TextInput id="department" /&gt;
			&lt;/mx:FormItem&gt;				
			&lt;mx:FormItem label="Email Address"&gt;
				&lt;mx:TextInput id="email" /&gt;
			&lt;/mx:FormItem&gt;
		&lt;/mx:Form&gt;
		
	&lt;!-- The myEmployee data model
	&lt;mx:Model id="myEmployee"&gt;
		&lt;name&gt;
			&lt;first/&gt;
			&lt;last/&gt;
		&lt;/name&gt;
		&lt;department/&gt;/
		&lt;email/&gt;
	&lt;/mx:Model&gt;
	...
	&lt;!-- Properties of user interface controls are bound to the
	myEmployee data model using &lt;mx:Binding&gt; tags --&gt;
	
	&lt;mx:Binding source="firstName.text" destination="myEmployee.name.first" /&gt;
	&lt;mx:Binding source="lastName.text" destination="myEmployee.name.last" /&gt;
	&lt;mx:Binding source="department.text" destination="myEmployee.department"/&gt;
	&lt;mx:Binding source="email.text" destination="myEmployee.email"/&gt;
	&lt;/mx:Application&gt;
</pre>
<hr>
<p></p>
<div class="liveDocsLink">
<center>
<a target="mm_livedocs" href="javascript:gotoLiveDocs('mxml/binding.html','mxml-tags.html');">Submit Feedback on LiveDocs</a>
</center>
</div>
<center class="copyright">Copyright &copy; 2005 Macromedia Inc. All rights reserved.<br>Tue Oct 11 2005, 23:44 PDT</center>
</body>
</html>
